//package org.jjche.core.conf;
//
//import cn.hutool.log.StaticLog;
//import org.apache.coyote.http11.AbstractHttp11Protocol;
//import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
//import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
//import org.springframework.boot.web.servlet.MultipartConfigFactory;
//import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.util.unit.DataSize;
//
//import javax.servlet.MultipartConfigElement;
//import java.io.File;
//
///**
// * <p>
// * 文件上传配置
// * </p>
// *
// * @author miaoyj
// * @version 1.0.8-SNAPSHOT
// * @since 2020-11-02
// */
//@Configuration
//public class MultipartConfig {
//
//    @Bean
//    MultipartConfigElement multipartConfigElement() {
//        MultipartConfigFactory factory = new MultipartConfigFactory();
//        String location = System.getProperty("user.home") + "/.jjche/file/tmp";
//        File tmpFile = new File(location);
//        if (!tmpFile.exists()) {
//            if (!tmpFile.mkdirs()) {
//                StaticLog.warn("create was not successful.");
//            }
//        }
//        factory.setLocation(location);
//        factory.setMaxFileSize(DataSize.ofMegabytes(2));
//        factory.setMaxRequestSize(DataSize.ofMegabytes(2));
//        return factory.createMultipartConfig();
//    }
//}
